class InputForm extends Control {
	
	private var fields:Collection;
	private var actions:Collection;
	private var formLabel:String;
	
	function InputForm(container:MovieClip, name:String){
		super(container);
		setName(name);
		fields=new Collection();
		actions=new Collection();
	};
	
	public function getFormLabel():String{
	return formLabel;
	}
	public function setFormLabel(formLabel:String){
	this.formLabel=formLabel;
	this.propagateChangeEvent();
	}

	public function addField(key:String, field:Field){
		fields.addItem(key, field);
		distributeFields();
		this.propagateChangeEvent();
	}

	public function removeField(key:String){
		fields.removeItem(key);
		reDraw();
		this.propagateChangeEvent();
	}

	public function removeFields(){
		fields=new Collection();
	}

	public function getField(key:String):CollectionItem{
		return fields.getItem(key);
	}
	
	public function getFields():Array{
		return fields.getItems();
	}

	public function addAction(action:Action){
		actions.addItem(action.getName(), action);
		this.propagateChangeEvent();
	}

	public function removeAction(key:String){
		actions.removeItem(key);
		this.propagateChangeEvent();
	}

	public function removeActions(){
		actions=new Collection();
	}

	public function getAction(key:String):CollectionItem{
		return actions.getItem(key);
	}
	
	public function getActions():Array{
		return actions.getItems();
	}

	public function reset(){
		for(var i:Number=0; i< fields.getItems().length; i++){
		fields.getItems()[i].getValue().reset();
		}
	}

	public function draw(){
		reDraw();
	}
	
	public function distributeFields(){
	}
	
	public function action(){
	propagateActionEvent();
	}
	
} // fin de clase